-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Judges] rlhflow pairwise judges #2548
base: main
Are you sure you want to change the base?
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
for prompt, completion_pair in zip(batch_prompts, batch_completions): | ||
# Convert prompt to chat format | ||
instruction = [{"role": "user", "content": prompt}] | ||
context = self.tokenizer_plain.apply_chat_template(instruction, tokenize=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend using trl.apply_chat_template
from the trl
data utils here. We've encountered several issues in the past when applying chat templates to partial sequences, and this approach would be more robust.
While one could argue that we control the chat template in this context, using trl.apply_chat_template
ensures that any future modifications to the chat template won't introduce unexpected issues here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so both this and the below changes are how the RLHF model recommends to do the scoring... I can check if it works using the chat template
|
||
self.tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True) | ||
self.tokenizer_plain = AutoTokenizer.from_pretrained(model_name, use_fast=True) | ||
self.tokenizer_plain.chat_template = "\n{% for message in messages %}{% if loop.index0 % 2 == 0 %}\n\n<turn> user\n {{ message['content'] }}{% endif %}{% endfor %}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to override the chat template btw?
From their demo code, this is what I get as input for the model:
doesn't make much sense to me:
Why not something like this instead:
|
you are using the instructions from here: https://huggingface.co/RLHFlow/pair-preference-model-LLaMA3-8B right? |
precisely |
What does this PR do?
add support for RLHFlow based pairwise judge